

using System;
using System.Collections.Generic;
using System.Text;
using EntityLayer;
using System.Data;
using DataAccessLayer;

namespace DataLayer
{
	public class datComments
	{
		public datComments()
		{
		}
		
		#region  Code Factory Generated Methods
		public void DeleteCommentsByCommentId(entComments parEntComments, DbConnector parDbConnector)
		{
			DbParamCollection insDbParamCollection = new DbParamCollection();
			insDbParamCollection.Add("@pCommentId",parEntComments.CommentId);
			parDbConnector.ExecuteNonQuery("DeleteCommentsByCommentId",insDbParamCollection);
		}
		public void InsertComments(entComments parEntComments, DbConnector parDbConnector)
		{
			DbParamCollection insDbParamCollection = new DbParamCollection();
			insDbParamCollection.Add("@pEntryContentId",parEntComments.EntryContentId);
			insDbParamCollection.Add("@pCommentUserName",parEntComments.CommentUserName);
			insDbParamCollection.Add("@pCommentUserWebSite",parEntComments.CommentUserWebSite);
			insDbParamCollection.Add("@pCommentUserEMail",parEntComments.CommentUserEMail);
			insDbParamCollection.Add("@pCommentUserIPAddress",parEntComments.CommentUserIPAddress);
			insDbParamCollection.Add("@pCommentDate",parEntComments.CommentDate);
			insDbParamCollection.Add("@pCommentBody",parEntComments.CommentBody);
			insDbParamCollection.AddOutput("@pCommentId",DbType.Int32);
			parDbConnector.ExecuteNonQuery("InsertComments",insDbParamCollection);
			parEntComments.CommentId = Convert.ToInt32(insDbParamCollection.GetOutPutParameter().Value);
		}
		#endregion
        public void DeleteCommentsByEntryContentId(entComments parEntComments, DbConnector parDbConnector)
        {
            DbParamCollection insDbParamCollection = new DbParamCollection();
            insDbParamCollection.Add("@pEntryContentId", parEntComments.EntryContentId);
            parDbConnector.ExecuteNonQuery("DeleteCommentsByEntryContentId", insDbParamCollection);
        }
        public DataTable SelectCommentsByEntryContentId(entComments parEntComments, DbConnector parDbConnector)
        {
            DbParamCollection insDbParamCollection = new DbParamCollection();
            insDbParamCollection.Add("@pEntryContentId", parEntComments.EntryContentId);
            return parDbConnector.ExecuteDataTable("SelectCommentsByEntryContentId", insDbParamCollection);
        }
	}
}